package cn.ssj.service.impl;

import cn.ssj.dao.DynamicDao;
import cn.ssj.entity.Dynamic;
import cn.ssj.service.DynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by Administrator on 2017/9/4 0004.
 */
@Service
public class DynamicServiceImpl extends BaseServiceImpl<Dynamic,Integer> implements DynamicService {
    @Autowired
    private DynamicDao dao;
    @Transactional
    public Dynamic insert(Dynamic entity) {
       return super.insert(entity);
    }
    @Transactional
    public Dynamic update(Dynamic entity) {
        return super.update(entity);
    }
    @Transactional
    public boolean delete(Integer id) {
        return super.delete(id);
    }

    /**
     * 根据实体使用标记进行查询useFlag
     *
     * @param useFlag 使用标记
     * @return
     */
    public List<Dynamic> queryByUseFlag(String useFlag) {
        return dao.findByUseFlagOrderByDynDateDesc(useFlag);
    }
}
